import request from "@/utils/request";
import PageResult from "@/types/global";
import { SearchShipCategoryQuery } from "@/api/search-ship/index.js";
const GENERATOR_BASE_URL = "/client";

const FavoriteApi = {
  getShipCategoryList(params: SearchShipCategoryQuery) {
    return request<any, PageResult<ShipFavorite[]>>({
      url: `${GENERATOR_BASE_URL}/ship/ship/shopCategory/list`,
      method: "get",
      params,
    });
  },
  /**  查询收藏列表 */
  listFavorites(params: SearchShipQuery) {
    return request<any, PageResult<ShipFavorite[]>>({
      url: `${GENERATOR_BASE_URL}/ship/ship/selectshipByfavorite`,
      method: "get",
      params,
    });
  },

  /**  新增收藏 */
  addFavorites(data: SearchShipCategoryQuery) {
    return request<any, PageResult<ShipFavorite[]>>({
      url: `${GENERATOR_BASE_URL}/ship/favorites`,
      method: "post",
      data: data,
    });
  },
  cancelFavorites(data: SearchShipCategoryQuery) {
    return request<any, PageResult<ShipFavorite[]>>({
      url: `${GENERATOR_BASE_URL}/ship/favorites`,
      method: "delete", // 主要修改方法为DELETE
      data: data, // 保持参数结构一致
    });
  },
};

export default FavoriteApi;
export { FavoriteApi };
// 保持原有方法不变，添加命名导出对象

/** 代码生成预览对象 */
export interface ShipFavorite {}

export interface SearchShipQuery {}
